home *** CD-ROM | disk | FTP | other *** search
/ World of Video / World of Video.iso / gfxprograms / 3dprograms / rayshade-4.0 / fixes / fix001 next >
Internet Message Format  |  1995-02-13  |  8KB

  1. From theseas!fs.Princeton.EDU!cek Sat, 23 Jan 93 01:35:28 EET
  2. Received: by kriton.UUCP (V1.16/Amiga)
  3.     id AA00000; Sat, 23 Jan 93 01:35:28 EET
  4. Received: by theseas.ntua.gr with UUCP; Fri, 22 Jan 93 04:36:19 +0200
  5. Received: from mcsun.EU.net by pythia.ics.forth.gr via ITEnet with SMTP;
  6.     id AA15276 (5.65c/FORTH-ICS-3.0-MHS-7.0); Fri, 22 Jan 1993 04:30:48 +0200
  7. Received: by mcsun.EU.net via EUnet
  8.     id AA02595 (5.65b/CWI-2.204); Fri, 22 Jan 1993 03:28:40 +0100
  9. Received: from Princeton.EDU by relay2.UU.NET with SMTP 
  10.     (5.61/UUNET-internet-primary) id AA13671; Thu, 21 Jan 93 21:27:55 -0500
  11. Received: from fs.Princeton.EDU by Princeton.EDU (5.65b/2.95/princeton)
  12.     id AA11439; Thu, 21 Jan 93 21:26:59 -0500
  13. Received: by fs.Princeton.EDU (4.1/1.105)
  14.     id AA05809; Thu, 21 Jan 93 21:26:56 EST
  15. Received: from po2.andrew.cmu.edu by fs.Princeton.EDU (4.1/1.105)
  16.     id AA05715; Thu, 21 Jan 93 21:26:11 EST
  17. Received: by po2.andrew.cmu.edu (5.54/3.15) id <AA15503@X> for rayshade-users@cs.princeton.edu; Thu, 21 Jan 93 21:26:02 EST
  18. Received: via switchmail; Thu, 21 Jan 1993 21:26:02 -0500 (EST)
  19. Received: from klotho.weh.andrew.cmu.edu via qmail
  20.           ID </afs/andrew.cmu.edu/service/mailqs/q002/QF.IfLpfrK00VpAQ0gUkS>;
  21.           Thu, 21 Jan 1993 21:24:55 -0500 (EST)
  22. Received: from klotho.weh.andrew.cmu.edu via qmail
  23.           ID </afs/andrew.cmu.edu/usr14/kf1o/.Outgoing/QF.YfLpfXy00VpAMCiUYy>;
  24.           Thu, 21 Jan 1993 21:24:37 -0500 (EST)
  25. Received: from Messages.7.15.N.CUILIB.3.45.SNAP.NOT.LINKED.klotho.weh.andrew.cmu.edu.pmax.ul4
  26.           via MS.5.6.klotho.weh.andrew.cmu.edu.pmax_ul4;
  27.           Thu, 21 Jan 1993 21:24:34 -0500 (EST)
  28. Message-Id: <YfLpfWq00VpAECiUR0@andrew.cmu.edu>
  29. Date: Thu, 21 Jan 1993 21:24:34 -0500 (EST)
  30. Errors-To: Princeton.EDU!cek
  31. Remailed-Date: Thu Jan 21 21:26:13 EST 1993
  32. From: Karl Frederik Fischer <cmu.edu!k+>
  33. To: cs.Princeton.EDU!rayshade-users
  34. Subject: bug fixes
  35.  
  36. Hello Rayshade users,
  37.  
  38. I have fixed a few bugs with the '-c' (continue) option.  These bugs
  39. showed up while I was running Rayshade distributed using some fancy
  40. shell scripts.  I do these distributed runs on machines available in
  41. public clusters here at CMU.  When someone logs onto the console of one
  42. of these machines foreign processes are terminated, so a reliable '-c'
  43. is very important to me.
  44.  
  45. I just joined the Rayshade mailing list so I don't know whether these
  46. bugs are news to you.  I am working from Rayshade 4.0 patchlevel 6.  My
  47. bug fixes are included below in "patch" format.  Here are the
  48. explanations of my changes:
  49.  
  50. - When playing animations made by distributed rendering I noticed an
  51. annoying jitter from frame to frame.  It turned out that each time an
  52. image was continued with '-c', one row of pixels was dropped at the
  53. point where rendering was interrupted.  All the rows above the missing
  54. row were shifted down by one and a blank row was left at the top.  These
  55. artifacts are hardly noticeable in single frames, but when playing
  56. animations in which some frames are missing rows and others aren't, the
  57. resulting jitter is quite noticeable.  I finally discovered the problem
  58. to be a subtlety of the RLE image format.  Each row of pixels in an RLE
  59. image is preceded by a "newline" sequence EXCEPT for the first row. 
  60. When an RLE image is reopened for appending, the RLE library thinks it
  61. is at the first row even though it isn't.  A "newline" gets left out so
  62. the first row of new pixels "overwrites" the last row of old pixels when
  63. the image is displayed.  The solution I found is to manually insert a
  64. "newline" using rle_skiprow() except when there is no pixel data in the
  65. image file (which means rendering was interrupted right after the header
  66. was written).
  67.  
  68. - When '-c' is used on a file that doesn't exist, Rayshade prints an
  69. error message and exits.  For my distributed rendering purposes it was
  70. useful to change this behaviour so that Rayshade will print a warning,
  71. create the file, and proceed with rendering.  This is not a bug fix,
  72. just an interface change, so do what you like with it.  Right now the
  73. warning just goes to stderr; I'm not sure whether this is the right
  74. thing to do in Rayshade's error handling scheme.
  75.  
  76. - An image is complete when Screen.miny > Screen.maxy, not when
  77. Screen.miny >= Screen.maxy.  Screen.miny is the y-coordinate of the
  78. first row which hasn't been rendered yet.  When Screen.miny ==
  79. Screen.maxy there is still one row left to render.
  80.  
  81. - I simplified count_rle_rows() by using rle_getskip() instead of
  82. rle_getraw().  Also I fixed a bug resulting from the assumption that a
  83. complete image will have data for every row.  This assumption is wrong! 
  84. When completely blank rows appear at the top of the image, absolutely
  85. NOTHING is written to the image file for these rows!  This behaviour
  86. (which I assume is one the RLE library's ways of compressing images) can
  87. cause Rayshade to append to an already complete image and corrupt it.
  88. The solution I found is to check for physical EOF.  If the image file
  89. has not reached physical EOF after skipping all the row data, then it
  90. must have reached a logical EOF marker (part of the RLE format).  A
  91. logical EOF means the image is complete, regardless of the amount of row
  92. data.
  93.  
  94. I hope you find these patches useful.  Feel free to use or modify them
  95. any way you like.
  96.  
  97. - Karl
  98.  
  99.  
  100. ---PATCH FILE-----CUT HERE---
  101. *** libshade/picture.c.orig    Sun Feb  9 22:04:06 1992
  102. --- libshade/picture.c    Sat Jan 16 00:11:14 1993
  103. ***************
  104. *** 86,91 ****
  105. --- 86,96 ----
  106.                       Options.imgname);
  107.           rle_dflt_hdr.rle_file = Options.pictfile;
  108.           rle_put_init(&rle_dflt_hdr);
  109. +         /*
  110. +          * Append "linefeed" to last line in outfile.
  111. +          */
  112. +         if (Screen.miny > rle_dflt_hdr.ymin)
  113. +             rle_skiprow(&rle_dflt_hdr, 1);
  114.       } else {
  115.           /*
  116.            * Starting image from scatch.
  117. ***************
  118. *** 153,160 ****
  119.        */
  120.       Options.pictfile = fopen(Options.imgname, "r");
  121.       if (Options.pictfile == (FILE *)NULL) {
  122. !         RLerror(RL_ABORT, "Cannot open image file %s.\n",
  123. !                     Options.imgname);
  124.       }
  125.       rle_dflt_hdr.rle_file = Options.pictfile;
  126.       rle_get_setup_ok(&rle_dflt_hdr, "rayshade", Options.imgname);
  127. --- 158,168 ----
  128.        */
  129.       Options.pictfile = fopen(Options.imgname, "r");
  130.       if (Options.pictfile == (FILE *)NULL) {
  131. !         fprintf(stderr,
  132. !             "Cannot open image file \"%s\".  Creating new file.\n",
  133. !             Options.imgname);
  134. !         Options.appending = FALSE;
  135. !         return;
  136.       }
  137.       rle_dflt_hdr.rle_file = Options.pictfile;
  138.       rle_get_setup_ok(&rle_dflt_hdr, "rayshade", Options.imgname);
  139. ***************
  140. *** 193,199 ****
  141.        * Determine number of scanlines written to file.
  142.        */
  143.       Screen.miny += count_rle_rows(&rle_dflt_hdr);
  144. !     if (Screen.miny >= Screen.maxy) {
  145.           fprintf(stderr, "\"%s\" is a complete image.\n",
  146.               Options.imgname);
  147.           exit(0);
  148. --- 201,207 ----
  149.        * Determine number of scanlines written to file.
  150.        */
  151.       Screen.miny += count_rle_rows(&rle_dflt_hdr);
  152. !     if (Screen.miny > Screen.maxy) {
  153.           fprintf(stderr, "\"%s\" is a complete image.\n",
  154.               Options.imgname);
  155.           exit(0);
  156. ***************
  157. *** 204,230 ****
  158.   }
  159.   
  160.   static int
  161. ! count_rle_rows( hdr )
  162.   rle_hdr *hdr;
  163.   {
  164. !     rle_op **raw;
  165. !     int *nraw, y, ynext;
  166.   
  167. !     if (rle_raw_alloc( hdr, &raw, &nraw ) < 0)  {
  168. !         RLerror(RL_PANIC,
  169. !             "Unable to allocate memory in count_rle_rows.\n");
  170. !     }
  171.   
  172. !     y = hdr->ymin;
  173. !     while ((ynext = rle_getraw( hdr, raw, nraw )) != 32768) {
  174. !         y = ynext+1;
  175. !         rle_freeraw( hdr, raw, nraw );
  176. !     }
  177.   
  178. !     /* Free memory. */
  179. !     rle_raw_free( hdr, raw, nraw );
  180. !     return y - hdr->ymin;
  181.   }
  182.   
  183.   /*
  184. --- 212,234 ----
  185.   }
  186.   
  187.   static int
  188. ! count_rle_rows(hdr)
  189.   rle_hdr *hdr;
  190.   {
  191. !     int y, ynext;
  192.   
  193. !     for (y = hdr->ymin - 1; (ynext = rle_getskip(hdr)) != 32768; y = ynext)
  194. !         ;
  195.   
  196. !     /*
  197. !      * If we have not reached physical EOF, then we must be at logical EOF
  198. !      * which means the image is complete regardless of the amount of
  199. !      * scanline data present.
  200. !      */
  201. !     if (!feof(hdr->rle_file))
  202. !         y = hdr->ymax;
  203.   
  204. !     return y - hdr->ymin + 1;
  205.   }
  206.   
  207.   /*
  208.  
  209. ----------
  210. Administrivia: rayshade-request@cs.princeton.edu
  211. Mailing list: rayshade-users@cs.princeton.edu
  212.  
  213.